Repository navigation
Support containers in to/from_numpy - #178
Conversation
1cfa1d4 to
1ea2620
Compare
1ea2620 to
f4ab671
Compare
inducer
left a comment
There was a problem hiding this comment.
Thanks for working on this! A few comments below.
| from arraycontext.impl.pyopencl.fake_numpy import PyOpenCLFakeNumpyNamespace | ||
| return PyOpenCLFakeNumpyNamespace(self) | ||
|
|
||
| def _map_container(self, func, array, allowed_types=None, strict=False): |
There was a problem hiding this comment.
Added in https://github.com/inducer/arraycontext/compare/f4ab671ce9eb96e9dd2397d9a77d5e7ac7c9be36..971df793aed6b5b107be09588c0791a2f664c2b9. I think it's correct, but probably could use a serious look.
85a96ec to
2dcdbfe
Compare
|
@inducer This should be ready for another go. I thought we could leave the deprecation parts for a follow-up PR, since this is already confusing and moves a lot of stuff around. |
66df690 to
049c1e5
Compare
|
Uh-oh, sorry. This has picked up some conflicts. 😬 |
c7c102a to
c1f557c
Compare
c1f557c to
bb4d8fc
Compare
Should be fixed now! Hopefully didn't miss anything. |
bb4d8fc to
8c9952a
Compare
|
LGTM, thanks! |
|
I think this might have broken pytential: https://github.com/inducer/loopy/runs/7156901597?check_suite_focus=true 😬 |
Oops! Sorry about that.. should be fixed by inducer/pytential#166! |
|
No need to apologize! Thanks for pushing a fix quickly. |
This is a bit bigger than it's supposed to be because it moves some things around to avoid a bit of duplicated code, but the main changes are:
actx.to_numpyandactx.from_numpy(deprecating the functions intraversal.py)actx.empty_like(andactx.zeros_like) to avoid confusion withactx.np.empty_like(andactx.np.zeros_like).TaggableCLArray.jax.np.allandjax.np.any: it was just forwarding tojnp.allwhich doesn't work right on containers.With this, all the functions in
ArrayContextthat should work with containers do.TODO
actx.empty_likeinactx.np.empty_like(same forzeros_like)